@echo off
echo Setting up Demo Project on Windows...

REM 检查 vcpkg 是否安装
if not exist "%VCPKG_ROOT%" (
    echo VCPKG_ROOT not found. Please install vcpkg first.
    echo git clone https://github.com/Microsoft/vcpkg.git
    echo .\vcpkg\bootstrap-vcpkg.bat
    echo setx VCPKG_ROOT "%CD%\vcpkg"
    pause
    exit /b 1
)

REM 使用 vcpkg 安装依赖
"%VCPKG_ROOT%\vcpkg" install libpqxx

REM 创建构建目录
if not exist "build" mkdir build
cd build

REM 配置和构建
cmake .. -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" -A x64
cmake --build . --config Release

echo Build completed successfully!
echo Run: .\src\Release\demo_app.exe
pause